char c[10001],d[20020];main(i,u,l,o,v,e,a){for(gets(c);gets(c);d[u]=0,puts(o&e?"Error!":d)){for(e=o=i=*c=='_',u=l=v=a=0;c[i];i++){v=c[i]>='A'&&c[i]<='Z';e|=v;o|=v&!i;if(v)d[u++]='_',d[u++]=c[i]+32;else if(l)d[u-1]=c[i]-32;else d[u++]=c[i];l=c[i]=='_';o|=l;}}}
